import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react-swc'
import tailwindcss from '@tailwindcss/vite'

// 实现路径别名
import { resolve } from 'path'

// https://vite.dev/config/
export default defineConfig({
  server: {
    port: 9000,
    host: '0.0.0.0',
  },
  resolve: {
    alias: {
      '@': resolve(__dirname, './src'),
      'packages': resolve(__dirname,"./packages")
    }
  },
  build: {
    rollupOptions: {
      // TODO 考虑是否将一些第三方包剔除出去
    },
    lib: {
      entry: 'packages/index.ts',
      name: 'x-react-components',
      fileName: (format) => `x-react-components.${format}.js`,
    },
  },

  plugins: [react(), tailwindcss()],
})
